#version 330 core

uniform vec3 u_LigthPos;
uniform float u_LigthIntensity;

in vec3 v_Position;
in vec3 v_LocalPosition;
in vec3 v_Normal;


out vec4 FragColor;












void main(void)
{
	vec3 eyed = vec3(0) - v_Position;
	vec3 diff = u_LigthPos - v_Position;
	vec3 dir = normalize(diff);
	float k = max(u_LigthIntensity*dot(dir, v_Normal)/(pow(length(diff), 2)), 0);
	vec3 ambient = vec3(0.1);
	vec3 color0 = v_LocalPosition*0.5 + vec3(0.5);
	vec3 color = color0*ambient + color0*k;
	FragColor = vec4(color, 1.0);
}